uniform sampler2D uni_sampler2D_normal;
uniform vec4 uni_vec4_diffuse;
uniform vec4 uni_vec4_specular;
varying vec4 var_vec4_position;
varying vec2 var_vec2_texcoord0;
varying vec3 var_vec3_normal;
varying mat3 var_mat3_tbn;

void main()
{
    vec3 pos=var_vec4_position.xyz;
	vec3 nor=texture2D(uni_sampler2D_normal,var_vec2_texcoord0).xyz;
	nor=nor*2.0-1.0;
	nor=var_mat3_tbn*nor;
	
    vec3 lightPos=vec3(0,0,0);
    vec3 lightDir=normalize(lightPos-pos);
	float diff=max(0.0,dot(nor,lightDir));
	
	vec3 eyeDir=normalize(-pos);
	vec3 reLight=normalize(reflect(lightDir,nor));
	float spec=(pow(max(0.0,dot(reLight,-eyeDir)),50.0));
	
	gl_FragColor=uni_vec4_diffuse*diff+uni_vec4_specular*spec;
}